package com.pjnkj.thunder.controller;

import com.pjnkj.thunder.dagger.Dagger;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 轮播图 前端控制器
 * </p>
 *
 * @author pjnkj
 * @since 2021-11-11
 */
@RestController
@RequestMapping("/thunder/dagger")
public class DaggerController {
    @PostMapping
    public Object dagger(HttpServletRequest request) throws Exception {

        Dagger dg = new Dagger(request.getParameterValues("operation")[0]);
        String re;
        if (dg.check()) {
            dg.wave(request);
            re = dg.getObject().toString();
        } else {
            re = "无此操作！";
        }
        return re;
    }
}
